package com.webex.ta.hydra.gui.table.celleditor;

import javax.swing.*;
import java.awt.*;

/**
 * Created by Cisco WebEx.
 * User: vegaz
 * Date: 2010-10-26
 * Time: 10:55:17
 */
public class TextArea2Editor extends DialogCellEditor {
    private static TextAreaEditorComponent editor = new TextAreaEditorComponent();

    static {
        editor.setPreferredSize(new Dimension(400, 300));
    }

    @Override
    protected AbstractEditorDialogComponent getEditorComponent() {
        return editor;
    }

    private static class TextAreaEditorComponent extends AbstractEditorDialogComponent {
        private JTextArea textArea;

        public TextAreaEditorComponent() {
            setLayout(new BorderLayout());
            textArea = new JTextArea();
            textArea.setBorder(BorderFactory.createLineBorder(Color.gray));
            add(new JLabel("Edit here"), BorderLayout.NORTH);
            add(textArea, BorderLayout.CENTER);
        }

        public String getValue() {
            return textArea.getText();
        }

        public void reset() {
            textArea.setText("");
        }

        public void setValue(String value) {
            textArea.setText(value);
        }
    }
}
